package com.gelsanalyzer.ui.swing.command;

import java.awt.event.*;
import java.beans.*;

import javax.swing.*;

import org.apache.log4j.*;

import com.gelsanalyzer.business.*;
import com.gelsanalyzer.mvc.controller.*;

public class AddCourseCommand extends AbstractAction implements Command {
    private static final Logger log = Logger.getLogger(AddCourseCommand.class);

    private IController controller;
    private Course  course;
    
    public AddCourseCommand(String text, IController controller) {
        this(text, null, null, null, controller);
    }

    public AddCourseCommand(String text,
                            ImageIcon icon,
                            String desc,
                            Integer mnemonic,
                            IController controller) {
        super(text, icon);
        putValue(SHORT_DESCRIPTION, desc);
        putValue(MNEMONIC_KEY, mnemonic);
        this.controller = controller;
    }
    
    public void setCourse(Course course) {        
        this.course = course;       
    }

    public void setController(IController controller) {
        this.controller = controller;
    }

    public void Execute() {
    }

    public void actionPerformed(ActionEvent arg0) {
        log.debug("Entered actionPerformed(ActionEvent) about "
                + "to call controller.propertyChange(PropertyChangeEvent)");
        controller.propertyChange(new PropertyChangeEvent(this,
            AbstractController.APP_ADDED_COURSE, null, course));
    }
}
